<?

$base_daylife_auth_proxy = 'http://develop.daylife.com/demos/tpb-auth.php?'; 

function daylifeAuth($email_address=NULL, $password=NULL) {
	
	if (($email_address === NULL) || ($password === NULL)) {
		return NULL;
	}
	
	
	global $base_daylife_auth_proxy;
	
	$request_url = $base_daylife_auth_proxy .
					'email_address=' .
					urlencode($email_address) .
					'&password=' .
					urlencode($password);
	$data = file_get_contents($request_url);
	
	try {
		$data = (array)json_decode($data);
		$data['payload'] = (array)$data['payload'];
		if (is_array($data) && isset($data['code'])) {
			return $data;
		}
		else
			return NULL;
	}
	catch(Exception $e) {
		return NULL;
	}
return NULL;
}

?>
